/**
 * ClassName: Exer03
 * Package: PACKAGE_NAME
 * Description:统计字符串中指定字母的数量；
 *
 * @Author fjorid
 * @Create 2025/2/25 20:45
 * @Version 1.0
 */
public class Exer03 {
    public static void main(String[] args) {
        Exer03 exer03 = new Exer03();
        String aaa = "want you to know one thing";
        System.out.println(exer03.LetterCount(aaa,'n'));
        System.out.println(exer03.LetterCount(aaa,'o'));

    }
    public int LetterCount(String a,char letter){
        int count = 0;
        for (int j = 0; j < a.length(); j++) {
            if (a.charAt(j) == letter){
                count++;
            }
        }
        return count;
    }
}
